package edu.wayne.cs.csc4110.hw6.framework.message;

import java.io.IOException;
import java.io.OutputStream;

import edu.wayne.cs.csc4110.hw6.interfaces.message.PrivateMessage;
import edu.wayne.cs.csc4110.hw6.interfaces.user.User;

/**
 * Default Private Message used for the Inbox
 * 
 * @author Andrew Giang
 * 
 */
public class InboxMessage implements PrivateMessage {

	private User sender, recipient;
	private String message, subject;

	public InboxMessage(User sender, User recipient, String msg, String subject) {
		this.message = msg;
		this.sender = sender;
		this.recipient = recipient;
		this.subject = subject;

	}

	@Override
	public String getMessage() {
		return this.message;
	}

	@Override
	public void write(OutputStream out) {
		try {
			out.write(getMessage().getBytes());
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	@Override
	public String getFormatedMessage() {
		return getMessage();
	}

	@Override
	public User getSender() {
		return this.sender;
	}

	@Override
	public User getRecipient() {
		return this.recipient;
	}

	@Override
	public String getSubject() {
		return subject;
	}

}
